From c0f854cfc665360f6edf2e83c643ea9ba0280526 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 3 Oct 2016 14:41:02 -0400 Subject: [PATCH] upgrade semver --- Cargo.lock | 24 ++++++++++++++---------- Cargo.toml | 2 +- src/cargo/core/dependency.rs | 19 ++++++++++++++++++- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8c348bfa6..7a43b2b62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,7 +27,7 @@ dependencies = [ "psapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.4.1 (git+https://github.com/steveklabnik/semver?branch=deprecation)", "tar 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -359,11 +359,6 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "nom" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "num" version = "0.1.34" @@ -527,10 +522,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "semver" -version = "0.2.3" +version = "0.4.1" +source = "git+https://github.com/steveklabnik/semver?branch=deprecation#a3b67d654d7e00ea0a05a37851f49352d79834a3" +dependencies = [ + "semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -680,7 +684,6 @@ dependencies = [ "checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54" "checksum miow 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5bfc6782530ac8ace97af10a540054a37126b63b0702ddaaa243b73b5745b9a" "checksum net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "5edf9cb6be97212423aed9413dd4729d62b370b5e1c571750e882cebbbc1e3e2" -"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce" "checksum num 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "d2ee34a0338c16ae67afb55824aaf8852700eb0f77ccd977807ccb7606b295f6" "checksum num-bigint 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc450723a2fe91d332a29edd8660e099b937d29e1a3ebe914e0da3f77ac1ad3" "checksum num-complex 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "8aabbc079e1855ce8415141fee0ebebf171f56505373b3a966e2716ad7c0e555" @@ -699,7 +702,8 @@ dependencies = [ "checksum regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)" = "56b7ee9f764ecf412c6e2fff779bca4b22980517ae335a21aeaf4e32625a5df2" "checksum regex-syntax 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "31040aad7470ad9d8c46302dcffba337bb4289ca5da2e3cd6e37b64109a85199" "checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b" -"checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f" +"checksum semver 0.4.1 (git+https://github.com/steveklabnik/semver?branch=deprecation)" = "" +"checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9" "checksum strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4d73a2c36a4d095ed1a6df5cbeac159863173447f7a82b3f4757426844ab825" "checksum tar 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "12e1b959f637c2e4c69dbdbf4d7dc609edbaada9b8c35d0c2fc9802d02383b65" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" diff --git a/Cargo.toml b/Cargo.toml index 083a8654e..563c86527 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ num_cpus = "1.0" psapi-sys = "0.1" regex = "0.1" rustc-serialize = "0.3" -semver = "0.2.3" +semver = { git = "https://github.com/steveklabnik/semver", branch = "deprecation" } tar = { version = "0.4", default-features = false } tempdir = "0.3" term = "0.4.4" diff --git a/src/cargo/core/dependency.rs b/src/cargo/core/dependency.rs index 48f4bd456..be8ff5d90 100644 --- a/src/cargo/core/dependency.rs +++ b/src/cargo/core/dependency.rs @@ -3,6 +3,7 @@ use std::rc::Rc; use std::str::FromStr; use semver::VersionReq; +use semver::ReqParseError; use rustc_serialize::{Encoder, Encodable}; use core::{SourceId, Summary, PackageId}; @@ -91,7 +92,7 @@ impl DependencyInner { version: Option<&str>, source_id: &SourceId) -> CargoResult { let (specified_req, version_req) = match version { - Some(v) => (true, try!(VersionReq::parse(v))), + Some(v) => (true, try!(DependencyInner::parse_with_deprecated(v))), None => (false, VersionReq::any()) }; @@ -103,6 +104,22 @@ impl DependencyInner { }) } + fn parse_with_deprecated(req: &str) -> Result { + match VersionReq::parse(req) { + Err(e) => { + match e { + ReqParseError::DeprecatedVersionRequirement(requirement) => { + // warn here + + Ok(requirement) + } + e => Err(e), + } + }, + Ok(v) => Ok(v), + } + } + pub fn new_override(name: &str, source_id: &SourceId) -> DependencyInner { DependencyInner { name: name.to_string(), -- 2.30.2